<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link type="text/css" rel="stylesheet" href="http://127.0.0.1/cms/cms/Template/default/css/page.css"/>
		<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/js/ajaxpingrun.js"></script>
		<title>PHP数组操作详解</title>
		<meta name="keywords" content=" 概述要访问一个变量的内容，可以直接使用其名称。如果该变量是一个数组，可以使用变量名称和关键字或索引的组">
		<meta name="description" content=" 概述要访问一个变量的内容，可以直接使用其名称。如果该变量是一个数组，可以使用变量名称和关键字或索引的组">
		<link rel="stylesheet" href="http://127.0.0.1/cms/cms/Template/default/css/style.css" />
<link type="text/css" rel="stylesheet" href="http://127.0.0.1/cms/cms/Static/hdjs/hdjs.css"/>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/js/jq17.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/hdjs/hdjs.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Template/default/js/js.js"></script>
<script type="text/javascript">
	var checkUser = "http://127.0.0.1/cms/cms/Index/User/ajaxCheckUser.html";
	var checkNick = "http://127.0.0.1/cms/cms/Index/User/ajaxCheckNickName.html";
	var checkCode = "http://127.0.0.1/cms/cms/Index/User/ajaxCheckCode.html";
	var checkLogin = "http://127.0.0.1/cms/cms/Index/user/ajaxLoginReturn";
	var ajaxPingLun = "http://127.0.0.1/cms/cms/Index/user/ajaxLoginReturn";
$(function(){
	$('#loginclose').click(function(){
		$(this).parents('.login_hide_box').hide();
	});
	$('#regclose').click(function(){
		$(this).parents('.reg_hide_box').hide();
	});
})
	
</script>
<script src="http://127.0.0.1/cms/cms/Static/js/ajaxlogin.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Template/default/js/validate.js"></script>

</head>
<body>
	<!-- 顶部100%灰色区域 -->
	<div id="top_dark_box">
		<!-- 中间1200px宽度区域 -->
		<div id="top_dark">
			<a href="http://127.0.0.1/cms/cms"><img src="http://127.0.0.1/cms/cms/Template/default/images/others/logo.jpg" id="logo" /></a>
			<!-- 导航菜单 -->
			<ul id="menu">
					
				<li>
					<a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/index.html">互联网新闻</a>
				</li>
				
	
				<li>
					<a href="http://127.0.0.1/cms/cms/Static/default/qdjs/index.html">前端技术</a>
				</li>
				
	
				<li>
					<a href="http://127.0.0.1/cms/cms/Static/default/cxysh/index.html">程序员生活</a>
				</li>
				
	
				<li>
					<a href="http://127.0.0.1/cms/cms/Static/default/cxkf/index.html">编程开发</a>
				</li>
				
	
				<li>
					<a href="http://127.0.0.1/cms/cms/Static/default/spjc/index.html">视频</a>
				</li>
				
			</ul>
			<!-- 导航菜单结束 -->
			<!-- 用户登录 -->
			
			<div id="loginInfo" class='loginInfo'>
				<div id="islogin" style="display:none;"><span></span><a href="http://127.0.0.1/cms/cms/Index/user/loginout">退出</a></div>
			 <div id="isout" style="display:none;">
				<a href="javascript:showLoginBox()" class="top_login">用户登录</a>
				<a href="javascript:showRegBox();">注册</a>
				</div>
			</div>
			<!-- 用户登录对应隐藏区域 -->
			<form id="loginForm" action="http://127.0.0.1/cms/cms/Index/user/login" method="post">
			<div class="login_hide_box">
				
				<img src="http://127.0.0.1/cms/cms/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：<span id="hd_username"></span> <a href="javascript:;" id="loginclose">关闭</a></p>
					<input type="text" name="username" class="text" />
					<p>密码：<span id="hd_password"></span></p>
					<input type="password" name="password" class="text" />
					<input type="submit" value="" class="sub" />
				</div>
				<div class="bottom">
					<a  href="javascript:showRegBox();" class="reg">注册</a>
				</div>
			</div>
			</form>
			
			<!-- 用户注册对应隐藏区域 -->
			<form id="regForm" action="http://127.0.0.1/cms/cms/Index/user/register" method="post">	
			<div class="reg_hide_box">
				<img src="http://127.0.0.1/cms/cms/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：<a href="javascript:;" id="regclose">关闭</a></p>
					<input type="text" name="username_reg" class="text username" />
					<p>昵称：</p>
					<input type="text" name="nickname" class="text nickname" />
					<p>密码：</p>
					<input type="password" name="password_reg1" class="text password" />
					<p>确认密码：</p>
					<input type="password" name="password_reg2" class="text password" />
					<p>验证码：</p>
					<img src="http://127.0.0.1/cms/cms/Index/user/code" id="code" onclick="this.src=this.src + '&' + Math.random()"/>
					<input type="text"  name="code" class="text password_d" />
					<input type="submit" value="注册" class="sub" />
				</div>
			</div>
			</form>
		</div>
		<!-- 中间1200px宽度区域结束 -->
	</div>
	<!-- 顶部灰色100%区域结束 -->
	
	<!-- 顶部最新消息区域 -->
	<div id="latest_news_box">
		<div id="latest_news">
			<p><span class="title">最新消息：
				
	<a href="http://127.0.0.1/cms/cms/Static/default/spjc/39.html">遇见你第4集 遇见</a>
	
			</span>
					
			</p>
		</div>
	</div>
	<!-- 顶部最新消息区域结束 -->
	<!-- 主体区域 -->
		<!-- 顶部最新消息区域结束 -->
		<!-- 主体区域 -->
		<div id="page_main">
			<!-- 右侧区域 -->
		<div class="right">
			<div class='hd_title'>
				<strong>标签云</strong>	
			</div>
			<div id="tagBox" class='tags'>
					
				<a href="http://127.0.0.1/cms/cms/t_21.html">Javascript</a>
				
	
				<a href="http://127.0.0.1/cms/cms/t_27.html">Qq</a>
				
	
				<a href="http://127.0.0.1/cms/cms/t_26.html">Ps</a>
				
	
				<a href="http://127.0.0.1/cms/cms/t_29.html">学习</a>
				
	
				<a href="http://127.0.0.1/cms/cms/t_30.html">技巧</a>
				
	
				<a href="http://127.0.0.1/cms/cms/t_31.html">互联新知识</a>
				
	
				<a href="http://127.0.0.1/cms/cms/t_32.html">node.js</a>
				
	
				<a href="http://127.0.0.1/cms/cms/t_33.html">NoSQL</a>
				
			</div>
			<div class='hd_title'>
				<strong>热门文章</strong>	
			</div>
			<ul class='arc_list'>
							
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/27.html">
								<img src="http://127.0.0.1/cms/cms/Upload/96251433839782.jpg" alt="史上最狡猾恶意软件现身：被发现后会自爆" />
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/27.html">史上最狡猾恶意软件现身：被发现后会自爆</a></h2>
						<p>
							<em>06-09</em><span>0条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/PHP/29.html">
								<img src="http://127.0.0.1/cms/cms/Upload/31951433986120.png" alt="PHP数组操作详解" />
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/PHP/29.html">PHP数组操作详解</a></h2>
						<p>
							<em>06-09</em><span>4条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/cxysh/28.html">
								<img src="http://127.0.0.1/cms/cms/Upload/44421433986208.jpg" alt="27种迹象你该考虑辞掉程序员的工作" />
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/cxysh/28.html">27种迹象你该考虑辞掉程序员的工作</a></h2>
						<p>
							<em>06-09</em><span>0条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/cxkf/32.html">
								<img src="http://127.0.0.1/cms/cms/Upload/19461433985994.jpg" alt="排名前十的SQL和NoSQL数据库" />
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/cxkf/32.html">排名前十的SQL和NoSQL数据库</a></h2>
						<p>
							<em>06-10</em><span>0条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/cxysh/30.html">
								<img src="http://127.0.0.1/cms/cms/Upload/8381433986088.gif" alt="麻省理工的 Picture 语言：代码瘦身的秘..." />
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/cxysh/30.html">麻省理工的 Picture 语言：代码瘦身的秘...</a></h2>
						<p>
							<em>06-09</em><span>4条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/33.html">
								<img src="http://127.0.0.1/cms/cms/Upload/54911433939108.png" alt="iOS 8.4 Beta 4才来，iOS 9解..." />
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/33.html">iOS 8.4 Beta 4才来，iOS 9解...</a></h2>
						<p>
							<em>06-10</em><span>2条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/qdjs/31.html">
								<img src="http://127.0.0.1/cms/cms/Upload/65401433986068.jpg" alt="10 个优秀的JavaScript开发框架" />
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/qdjs/31.html">10 个优秀的JavaScript开发框架</a></h2>
						<p>
							<em>06-10</em><span>0条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/spjc/39.html">
								<img src="http://127.0.0.1/cms/cms/Upload/86131433984486.jpg" alt="遇见你第4集 遇见" />
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/spjc/39.html">遇见你第4集 遇见</a></h2>
						<p>
							<em>06-11</em><span>0条评论</span>
						</p>
					</li>
					
			</ul>
			<div class='hd_title'>
				<strong>推荐文章</strong>	
			</div>
			
			<ul class='arc_list'>
							
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/27.html">
								<img src="http://127.0.0.1/cms/cms/Upload/96251433839782.jpg" alt="史上最狡猾恶意软件现身：被发现后会自爆"/>
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/27.html">史上最狡猾恶意软件现身：被发现后会自爆</a></h2>
						<p>
							<em>06-09</em><span>0条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/cxysh/28.html">
								<img src="http://127.0.0.1/cms/cms/Upload/44421433986208.jpg" alt="27种迹象你该考虑辞掉程序员的工作"/>
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/cxysh/28.html">27种迹象你该考虑辞掉程序员的工作</a></h2>
						<p>
							<em>06-09</em><span>0条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/cxysh/30.html">
								<img src="http://127.0.0.1/cms/cms/Upload/8381433986088.gif" alt="麻省理工的 Picture 语言：代码瘦身的秘诀"/>
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/cxysh/30.html">麻省理工的 Picture 语言：代码瘦身的秘诀</a></h2>
						<p>
							<em>06-09</em><span>4条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/33.html">
								<img src="http://127.0.0.1/cms/cms/Upload/54911433939108.png" alt="iOS 8.4 Beta 4才来，iOS 9解锁密..."/>
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/33.html">iOS 8.4 Beta 4才来，iOS 9解锁密...</a></h2>
						<p>
							<em>06-10</em><span>2条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/37.html">
								<img src="http://127.0.0.1/cms/cms/Upload/67401433983887.png" alt="Mozilla 发布能运行在 Android 上的..."/>
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/37.html">Mozilla 发布能运行在 Android 上的...</a></h2>
						<p>
							<em>06-11</em><span>0条评论</span>
						</p>
					</li>
					
		
					<li>
						<div class='image'>
							<a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/34.html">
								<img src="http://127.0.0.1/cms/cms/Upload/87721433985941.jpg" alt="GitHub Atom 0.208.0 发布，文本..."/>
							</a>
						</div>
						<h2><a href="http://127.0.0.1/cms/cms/Static/default/hlwxw/34.html">GitHub Atom 0.208.0 发布，文本...</a></h2>
						<p>
							<em>06-11</em><span>0条评论</span>
						</p>
					</li>
					
		
			</ul>
		</div>
		<!-- 右侧区域结束 -->
			<!-- 左侧 -->
			<div class="left">
				<h1><a href="">PHP数组操作详解</a></h1>
				<!-- 文章信息 -->
				<div class="article_info_box">
					<p class="article_info">
						<span class="padding_right">发表时间:06-09 16:03:19</span> 分类：
						<a href="http://127.0.0.1/cms/cms/Index/list/cid/30" class="padding_right">PHP</a>
						<a href="" class="padding_right comment">4条评论</a>
						<span id="click">150</span>次浏览
					</p>
				</div>
				<!-- 文章信息结束 -->

				<!-- 文章内容区域 -->
				<div class="article_content">
					<h2 id="articleHeader1">数组的基本操作</h2><h3 id="articleHeader2">php定义数组：</h3><h3 id="articleHeader2">&nbsp;</h3><pre class="hljs xml">&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;$array&nbsp;=&nbsp;array();&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;$array[&quot;key&quot;]&nbsp;=&nbsp;&quot;values&quot;;&nbsp;&nbsp;
?&gt;</pre><p>在<code>PHP</code>中声明数组的方式主要有两种：</p><p>1.用<code>array()</code>函数声明数组，<br/>2.直接为数组元素赋值。</p><pre class="hljs xml">&nbsp;&nbsp;&nbsp;&nbsp;//array数组
&nbsp;&nbsp;&nbsp;&nbsp;$users&nbsp;=&nbsp;array(&#39;phone&#39;,&#39;computer&#39;,&#39;dos&#39;,&#39;linux&#39;);&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$users;//只会打印出数据类型Array
&nbsp;&nbsp;&nbsp;&nbsp;print_r($users);//Array&nbsp;(&nbsp;[0]&nbsp;=&gt;&nbsp;phone&nbsp;[1]&nbsp;=&gt;&nbsp;computer&nbsp;[2]&nbsp;=&gt;&nbsp;dos&nbsp;[3]&nbsp;=&gt;&nbsp;linux&nbsp;)

&nbsp;&nbsp;&nbsp;&nbsp;$numbers&nbsp;=&nbsp;range(1,5);//创建一个包含指定范围的数组
&nbsp;&nbsp;&nbsp;&nbsp;print_r($numbers);//Array&nbsp;(&nbsp;[0]&nbsp;=&gt;&nbsp;1&nbsp;[1]&nbsp;=&gt;&nbsp;2&nbsp;[2]&nbsp;=&gt;&nbsp;3&nbsp;[3]&nbsp;=&gt;&nbsp;4&nbsp;[4]&nbsp;=&gt;&nbsp;5&nbsp;)
&nbsp;&nbsp;&nbsp;&nbsp;print_r(true);//1
&nbsp;&nbsp;&nbsp;&nbsp;var_dump(false);//bool(false)//print_r可以把字符串和数字简单地打印出来，数组会以Array开头并已键值形式表示，print_r输出布尔值和null的结果没有意义，因此用var_dump更合适//通过循环来显示数组里所有的值
&nbsp;&nbsp;&nbsp;&nbsp;for($i&nbsp;=&nbsp;0&nbsp;;$i&nbsp;&lt;&nbsp;5;$i++){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$users[$i];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&#39;
&#39;;
&nbsp;&nbsp;&nbsp;&nbsp;}//通过count/sizeof统计数组中单元数目或对象中的属性个数

&nbsp;&nbsp;&nbsp;&nbsp;for($i&nbsp;=&nbsp;0;&nbsp;$i&nbsp;&lt;&nbsp;count($users);$i++){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$users[$i];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&#39;
&#39;;
&nbsp;&nbsp;&nbsp;&nbsp;}//还可以通过foreach循环来遍历数组，这种好处在于不需要考虑key
&nbsp;&nbsp;&nbsp;&nbsp;foreach($users&nbsp;as&nbsp;$value){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$value.&#39;
&#39;;//点号为字符串连接符号
&nbsp;&nbsp;&nbsp;&nbsp;}//foreach循环遍历&nbsp;$key&nbsp;=&gt;&nbsp;$value；$key和$value是变量名，可以自行设置
&nbsp;&nbsp;&nbsp;&nbsp;foreach($users&nbsp;as&nbsp;$key&nbsp;=&gt;&nbsp;$value){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$key.&#39;
&#39;;//输出键
&nbsp;&nbsp;&nbsp;&nbsp;}?&gt;</pre><h3 id="articleHeader3">创建自定义键的数组</h3><h3>&nbsp;</h3><pre class="hljs xml">&nbsp;&nbsp;&nbsp;&nbsp;//创建自定义键的数组
&nbsp;&nbsp;&nbsp;&nbsp;$ceo&nbsp;=&nbsp;array(&#39;apple&#39;=&gt;&#39;jobs&#39;,&#39;microsoft&#39;=&gt;&#39;Nadella&#39;,&#39;Larry&nbsp;Page&#39;,&#39;Eric&#39;);&nbsp;&nbsp;&nbsp;&nbsp;//如果不去声明元素的key,它会从零开始
&nbsp;&nbsp;&nbsp;&nbsp;print_r($ceo);//Array&nbsp;(&nbsp;[apple]&nbsp;=&gt;&nbsp;jobs&nbsp;[microsoft]&nbsp;=&gt;&nbsp;Nadella&nbsp;[0]&nbsp;=&gt;&nbsp;Larry&nbsp;Page&nbsp;[1]&nbsp;=&gt;&nbsp;Eric&nbsp;)

&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$ceo[&#39;apple&#39;];//jobs

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//php5.4起的用法
&nbsp;&nbsp;&nbsp;&nbsp;$array&nbsp;=&nbsp;[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;foo&quot;&nbsp;=&gt;&nbsp;&quot;bar&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;bar&quot;&nbsp;=&gt;&nbsp;&quot;foo&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;];

&nbsp;&nbsp;&nbsp;&nbsp;print_r($array);//Array&nbsp;(&nbsp;[foo]&nbsp;=&gt;&nbsp;bar&nbsp;[bar]&nbsp;=&gt;&nbsp;foo&nbsp;)&nbsp;?&gt;</pre><p>从<code>php5.4</code> 起可以使用短数组定义语法，用 <code>[]</code> 替代 <code>array()</code>。有点类似于<code>javascript</code>中数组的定义。</p><h3 id="articleHeader4">each()的使用</h3><h3>&nbsp;</h3><pre class="hljs xml">&nbsp;&nbsp;&nbsp;&nbsp;//通过为数组元素赋值来创建数组
&nbsp;&nbsp;&nbsp;&nbsp;$ages[&#39;trigkit4&#39;]&nbsp;=&nbsp;22;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$ages.&#39;
&#39;;//Array
&nbsp;&nbsp;&nbsp;&nbsp;//因为相关数组的索引不是数字，所以无法通过for循环来进行遍历操作，只能通过foreach循环或list()和each()结构

&nbsp;&nbsp;&nbsp;&nbsp;//each的使用
&nbsp;&nbsp;&nbsp;&nbsp;//each返回数组中当前的键/值对并将数组指针向前移动一步
&nbsp;&nbsp;&nbsp;&nbsp;$users&nbsp;=&nbsp;array(&#39;trigkit4&#39;=&gt;22,&#39;mike&#39;=&gt;20,&#39;john&#39;=&gt;30);&nbsp;&nbsp;&nbsp;&nbsp;//print_r(each($users));//Array&nbsp;(&nbsp;[1]&nbsp;=&gt;&nbsp;22&nbsp;[value]&nbsp;=&gt;&nbsp;22&nbsp;[0]&nbsp;=&gt;&nbsp;trigkit4&nbsp;[key]&nbsp;=&gt;&nbsp;trigkit4&nbsp;)

&nbsp;&nbsp;&nbsp;//相当于：$a&nbsp;=&nbsp;array([0]=&gt;trigkit4,[1]=&gt;22,[value]=&gt;22,[key]=&gt;trigkit4);
&nbsp;&nbsp;&nbsp;&nbsp;$a&nbsp;=&nbsp;each($users);//each把原来的数组的第一个元素拿出来包装成新数组后赋值给$a
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$a[0];//trigkit4

&nbsp;&nbsp;&nbsp;&nbsp;//!!表示将真实存在的数据转换成布尔值
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;!!each($users);//1?&gt;</pre><p><code>each</code>的指针指向第一个键值对，并返回第一个数组元素，获取其键值对，并包装成新数组</p><h3 id="articleHeader5">list()的使用</h3><h3>&nbsp;</h3><p><code>list</code>用来把数组用的值赋给一些变量，看下面例子：</p><pre class="hljs xml">&nbsp;&nbsp;&nbsp;&nbsp;$a&nbsp;=&nbsp;[&#39;2&#39;,&#39;abc&#39;,&#39;def&#39;];&nbsp;&nbsp;&nbsp;&nbsp;list($var1,$var2)&nbsp;=&nbsp;$a;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$var1.&#39;
&#39;;//2
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$var2;//abc

&nbsp;&nbsp;&nbsp;&nbsp;$a&nbsp;=&nbsp;[&#39;name&#39;=&gt;&#39;trigkit4&#39;,&#39;age&#39;=&gt;22,&#39;0&#39;=&gt;&#39;boy&#39;];&nbsp;&nbsp;&nbsp;&nbsp;//list只认识key为数字的索引
&nbsp;&nbsp;&nbsp;&nbsp;list($var1,$var2)&nbsp;=&nbsp;$a;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$var1;//boy?&gt;</pre><p>注：<code>list</code>只认识key为数字的索引</p><p><br/></p>				</div>
				<!-- 文章内容区域结束 -->

				<p class="position">当前位置：<a href="http://127.0.0.1/cms/cms/Index/list/cid/30">PHP</a> » <a href="">PHP数组操作详解</a>
				</p>
				<p class="tags">
					继续浏览有关
					<!-- //标签 -->
											<a href="">技巧</a>
											<a href="">学习</a>
										的文章</p>
				<!-- 相关文章 -->
				<ul id="msg_list" class="msg_list">
					<p id="loading">
						<img src="http://127.0.0.1/cms/cms/Template/default/images/loading.gif" style='width:50px;height:50px;'>
					</p>
					<div>
						评论：
						<ul class="comment-ul">
														<li style="padding:10px;">
								<strong style="margin:0 10px;font-size:18px;">19901990: </strong>
								<span style="font-size:18px;">1111111111111111</span> 
								<span style="font-size:13px;color:#999;float:right">2015-06-11</span>
							</li>
														<li style="padding:10px;">
								<strong style="margin:0 10px;font-size:18px;">baibaibai: </strong>
								<span style="font-size:18px;">111111111111</span> 
								<span style="font-size:13px;color:#999;float:right">2015-06-10</span>
							</li>
														<li style="padding:10px;">
								<strong style="margin:0 10px;font-size:18px;">admin: </strong>
								<span style="font-size:18px;">真是不错的东西</span> 
								<span style="font-size:13px;color:#999;float:right">2015-06-07</span>
							</li>
													</ul>
					</div>
				</ul>
				<div id="comment-form-box" style="display:none;">
						<form id="commentForm" action="http://127.0.0.1/cms/cms/Index/Details/comment.html" method="post">
							<input type="hidden" name="article_aid" value="29" />
							<textarea id="comment_content" name="comcon"></textarea>
							<input class='submit' type="submit" value="发表评论">
						</form>
					</div>
				
				<!-- 主体区域结束 -->
				<!-- 底部浅灰色导航区域 -->
					<!-- 底部浅灰色导航区域 -->
	<div id="bottom_menu_box" style="margin-top:30px;">
		<div class="bottom_menu">
				
			<dl>
				    					<dt><a href="http://111.com" style="margin-top:10px;"><img src="http://127.0.0.1/cms/cms/Upload/30721433822993.jpg" alt="11" /></a></dt>
								</dl>
			
	
			<dl>
				    					<dt><a href="http://www.houdunwang.com" style="margin-top:10px;"><img src="http://127.0.0.1/cms/cms/" alt="后盾网" /></a></dt>
								</dl>
			
	
			<dl>
				    					<dt><a href="http://www.qq.com" style="margin-top:10px;"><img src="http://127.0.0.1/cms/cms/" alt="腾讯QQ" /></a></dt>
								</dl>
			
	
			<dl>
				    					<dt><a href="http://www.baidu.com" style="margin-top:10px;"><img src="http://127.0.0.1/cms/cms/Upload/45881433853855.jpeg" alt="百度" /></a></dt>
								</dl>
			
	
		</div>
	</div>
	<!-- 底部浅灰色导航区域结束 -->

	<!-- 底部版权区域 -->
	<div id="bottom_copyright_box">
		<div class="bottom_copyright">
			版权信息:Copyright 2015 邦CMS		</div>
	</div>
	<!-- 底部版权区域结束 -->
	
</body>
</html>